#include <iostream>
#include <map>
#include <algorithm>
#include <stack>

using namespace std;
void printk()
{
    static int flag = 0;
    if(flag)cout<<' ';
    flag ++;
}
int main()
{
    char s[50];
    int  c = 0;
    string a;
    cin>>a;
    map<char,int>p;
    p['*'] = p['/'] = 1;
    p['('] = p[')'] = 2;
    for(int i = 0;i < a.size();i ++){
        if((i < 1 || a[i - 1] == '(')&&(a[i] == '+' || a[i] == '-')  || a[i] == '.' || a[i] >= '0' && a[i] <= '9')
        {
            printk();
            if(a[i] != '+')cout<<a[i];
            while(a[i + 1] == '.' || a[i + 1] >= '0' && a[i + 1] <= '9')
            {
                i ++;
                cout<<a[i];
            }
        }
        else
        {
            if(a[i] == ')')
            {
                while(c && s[c - 1] != '(')
                {
                    cout<<' '<<s[c - 1];
                    c --;
                }
                c --;

            }
            else if(!c || p[a[i]] > p[s[c - 1]])
            {
                s[c ++] = a[i];
            }
            else
            {
                while(c && s[c - 1] != '(')
                {
                    cout<<' '<<s[c - 1];
                    c --;
                }
                s[c ++] = a[i];
            }
        }
    }
    while(c)
    {
        cout<<' '<<s[c - 1];
        c --;
    }
    cout<<endl;
}
